192 lines
8 KiB
HTML
192 lines
8 KiB
HTML
{{define "enquiry-table"}}
|
|
<div class="table-container">
|
|
<table class="table is-fullwidth is-striped is-hoverable enquiry-table">
|
|
<thead>
|
|
<tr>
|
|
<th>User</th>
|
|
<th>Date</th>
|
|
<th>Principle</th>
|
|
<th>Enquiry Number</th>
|
|
<th>Customer</th>
|
|
<th>Contact</th>
|
|
<th>Email</th>
|
|
<th>Phone No</th>
|
|
<th>Status</th>
|
|
<th>Comments</th>
|
|
<th>Actions</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{{range .Enquiries}}
|
|
{{$rowClass := ""}}
|
|
{{$nameClass := ""}}
|
|
|
|
{{/* Set row color based on status - matching CakePHP logic */}}
|
|
{{if eq .StatusID 3}}
|
|
{{$rowClass = "jobwon"}}
|
|
{{else if eq .StatusID 4}}
|
|
{{$rowClass = "joblost"}}
|
|
{{else if eq .StatusID 8}}
|
|
{{$rowClass = "joblost"}}
|
|
{{else if eq .StatusID 9}}
|
|
{{$rowClass = "joblost"}}
|
|
{{else if eq .StatusID 10}}
|
|
{{$rowClass = "joblost"}}
|
|
{{else if eq .StatusID 6}}
|
|
{{$rowClass = "information"}}
|
|
{{else if eq .StatusID 11}}
|
|
{{$rowClass = "informationsent"}}
|
|
{{else if eq .StatusID 5}}
|
|
{{$rowClass = "quoted"}}
|
|
{{else if eq .StatusID 1}}
|
|
{{$rowClass = "requestforquote"}}
|
|
{{end}}
|
|
|
|
{{/* Set name class based on posted status */}}
|
|
{{if .Posted}}
|
|
{{$nameClass = "posted"}}
|
|
{{else}}
|
|
{{$nameClass = "notposted"}}
|
|
{{end}}
|
|
|
|
<tr class="{{$rowClass}} {{if .Archived}}archived-row{{end}}"
|
|
id="row{{.ID}}"
|
|
data-archived="{{.Archived}}">
|
|
|
|
<!-- User (initials) -->
|
|
<td class="{{$nameClass}}">
|
|
{{if and .UserFirstName.Valid .UserLastName.Valid}}
|
|
<a href="/users/{{.UserID}}" title="{{.UserFirstName.String}} {{.UserLastName.String}}">
|
|
{{slice .UserFirstName.String 0 1}}{{slice .UserLastName.String 0 1}}
|
|
</a>
|
|
{{else}}
|
|
-
|
|
{{end}}
|
|
</td>
|
|
|
|
<!-- Date -->
|
|
<td class="enqdate">
|
|
{{.Created.Format "2 Jan 2006"}}
|
|
</td>
|
|
|
|
<!-- Principle -->
|
|
<td class="principlename">
|
|
{{if .PrincipleShortName.Valid}}
|
|
<a href="/principles/{{.PrincipleID}}">{{.PrincipleShortName.String}}</a>
|
|
{{else if .PrincipleName.Valid}}
|
|
<a href="/principles/{{.PrincipleID}}">{{.PrincipleName.String}}</a>
|
|
{{else}}
|
|
-
|
|
{{end}}
|
|
</td>
|
|
|
|
<!-- Enquiry Number -->
|
|
<td>
|
|
<a href="/enquiries/{{.ID}}">{{.Title}}</a>
|
|
</td>
|
|
|
|
<!-- Customer -->
|
|
<td class="customername">
|
|
{{if .CustomerName.Valid}}
|
|
<a href="/customers/{{.CustomerID}}">{{.CustomerName.String}}</a>
|
|
{{else}}
|
|
-
|
|
{{end}}
|
|
</td>
|
|
|
|
<!-- Contact -->
|
|
<td class="contactname">
|
|
{{if and .ContactFirstName.Valid .ContactLastName.Valid}}
|
|
<a href="/users/{{.ContactUserID}}">{{.ContactFirstName.String}} {{.ContactLastName.String}}</a>
|
|
{{else}}
|
|
-
|
|
{{end}}
|
|
</td>
|
|
|
|
<!-- Email -->
|
|
<td class="contactemail">
|
|
{{if .ContactEmail.Valid}}
|
|
<a href="mailto:{{.ContactEmail.String}}?subject={{.Title}}&bcc=carpis@cmctechnologies.com.au">
|
|
{{.ContactEmail.String}}
|
|
</a>
|
|
{{else}}
|
|
-
|
|
{{end}}
|
|
</td>
|
|
|
|
<!-- Phone -->
|
|
<td class="contactphone">
|
|
{{if .ContactMobile.Valid}}
|
|
{{.ContactMobile.String}}
|
|
{{else if .ContactDirectPhone.Valid}}
|
|
{{.ContactDirectPhone.String}}
|
|
{{else if .ContactPhone.Valid}}
|
|
{{.ContactPhone.String}}
|
|
{{if .ContactPhoneExtension.Valid}}
|
|
ext:{{.ContactPhoneExtension.String}}
|
|
{{end}}
|
|
{{else}}
|
|
-
|
|
{{end}}
|
|
</td>
|
|
|
|
<!-- Status (editable) -->
|
|
<td class="statusTD">
|
|
<div class="status" id="{{.ID}}">
|
|
{{if .StatusName.Valid}}
|
|
{{.StatusName.String}}
|
|
{{else}}
|
|
-
|
|
{{end}}
|
|
</div>
|
|
</td>
|
|
|
|
<!-- Comments -->
|
|
<td class="comments">
|
|
{{if gt (len .Comments) 150}}
|
|
{{slice .Comments 0 150}}
|
|
<a href="/enquiries/{{.ID}}">.....more</a>
|
|
{{else}}
|
|
{{.Comments}}
|
|
{{end}}
|
|
</td>
|
|
|
|
<!-- Actions -->
|
|
<td class="viewedit">
|
|
<div class="buttons are-small">
|
|
<a href="/enquiries/{{.ID}}" class="button is-info is-small">View</a>
|
|
<a href="/enquiries/{{.ID}}/edit" class="button is-warning is-small">Edit</a>
|
|
|
|
{{if .Archived}}
|
|
<button
|
|
class="button is-success is-small"
|
|
hx-put="/api/v1/enquiries/{{.ID}}/undelete"
|
|
hx-confirm="Are you sure you want to undelete this enquiry?"
|
|
hx-target="#row{{.ID}}"
|
|
hx-swap="outerHTML">
|
|
Undelete
|
|
</button>
|
|
{{else}}
|
|
<button
|
|
class="button is-danger is-small"
|
|
hx-delete="/api/v1/enquiries/{{.ID}}"
|
|
hx-confirm="Are you sure you want to delete this enquiry?"
|
|
hx-target="#row{{.ID}}"
|
|
hx-swap="outerHTML">
|
|
Delete
|
|
</button>
|
|
{{end}}
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
{{else}}
|
|
<tr>
|
|
<td colspan="11" class="has-text-centered">
|
|
<em>No enquiries found.</em>
|
|
</td>
|
|
</tr>
|
|
{{end}}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
{{end}} |