Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.
C# aspnet-corecsharpdockerdotnetecommerceecommerce-platformmongodbmulti-storemulti-vendornosqlonline-shopshoppingcart
@using Grand.Domain.Media
@model OrderModel
@{
ViewData["DownloadType"] = DownloadType.Order;
ViewData["ReferenceId"] = Model.Id;
var area = ViewContext.RouteData.Values["area"]?.ToString();
}
<div class="grand-card">
<partial name="Partials/WidgetZone.Notes.Top" model="Model"/>
<div class="grand-card__body grand-card__body--flush">
<admin-grid id="ordernotes-grid"
read-url="@Url.Action("OrderNotesSelect", "Order", new { orderId = Model.Id, area = area })"
destroy-url="@Url.Action("OrderNoteDelete", "Order", new { orderId = Model.Id, area = area })"
pager="Compact"
auto-bind="false">
<grid-text name="link" value="@Loc["Admin.Orders.OrderNotes.Fields.Download.Link"]"/>
<grid-text name="no" value="@Loc["Admin.Orders.OrderNotes.Fields.Download.Link.No"]"/>
<grid-column field="CreatedOn" title="@Loc["Admin.Orders.OrderNotes.Fields.CreatedOn"]" width="180" format="{0:G}"/>
<grid-column field="Note" title="@Loc["Admin.Orders.OrderNotes.Fields.Note"]" width="350"/>
<grid-column field="DownloadId" title="@Loc["Admin.Orders.OrderNotes.Fields.Download"]" width="100">
<cell-template>
<a data-if="DownloadId != ''" href="@Url.Action("DownloadFile", "Download", new { area = area })/?downloadGuid={{ DownloadGuid }}">{{ $texts.link }}</a>
<span data-else>{{ $texts.no }}</span>
</cell-template>
</grid-column>
<grid-column field="CreatedByCustomer" title="@Loc["Admin.Orders.OrderNotes.Fields.CreatedByCustomer"]" width="100" align="Center">
<cell-template>
<i data-if="CreatedByCustomer" class="bi bi-check-lg text-success" aria-hidden="true"></i>
<i data-else class="bi bi-x-lg text-danger" aria-hidden="true"></i>
</cell-template>
</grid-column>
<grid-column field="DisplayToCustomer" title="@Loc["Admin.Orders.OrderNotes.Fields.DisplayToCustomer"]" width="100" align="Center">
<cell-template>
<i data-if="DisplayToCustomer" class="bi bi-check-lg text-success" aria-hidden="true"></i>
<i data-else class="bi bi-x-lg text-danger" aria-hidden="true"></i>
</cell-template>
</grid-column>
<grid-commands destroy="true" title="@Loc["Admin.Common.Delete"]" width="100"/>
</admin-grid>
</div>
<partial name="Partials/WidgetZone.Notes.Bottom" model="Model"/>
</div>
<script>
$(document).ready(function () {
$("#@Html.IdFor(model => model.AddOrderNoteHasDownload)").change(toggleAddOrderNoteHasDownload);
toggleAddOrderNoteHasDownload();
});
function toggleAddOrderNoteHasDownload() {
if ($('#@Html.IdFor(model => model.AddOrderNoteHasDownload)').is(':checked')) {
$('#pnlAddOrderNoteDownloadId').show();
}
else {
$('#pnlAddOrderNoteDownloadId').hide();
}
}
</script>
<admin-card title="@Loc["Admin.Orders.OrderNotes.AddTitle"]">
<div class="grand-fields">
<admin-field asp-for="AddOrderNoteMessage">
<admin-textarea asp-for="AddOrderNoteMessage"></admin-textarea>
</admin-field>
<admin-field asp-for="AddOrderNoteHasDownload" asp-label-for="AddOrderNoteDownloadId"/>
<div id="pnlAddOrderNoteDownloadId">
<admin-input asp-for="AddOrderNoteDownloadId"/>
<span asp-validation-for="AddOrderNoteDownloadId"></span>
</div>
<admin-field asp-for="AddOrderNoteDisplayToCustomer"/>
</div>
<div class="mt-3">
<button type="button" id="addOrderNote" class="btn btn-outline-secondary btn-sm"><i class="bi bi-plus-lg"></i> @Loc["Admin.Orders.OrderNotes.AddButton"]</button>
</div>
</admin-card>
<script>
$(document).ready(function () {
$('#addOrderNote').click(function () {
var orderNoteMessage = $("#@Html.IdFor(model => model.AddOrderNoteMessage)").val();
if (orderNoteMessage.length == 0) {
alert('Message text is required');
return;
}
var orderNoteDownloadId = '';
if ($('#@Html.IdFor(model => model.AddOrderNoteHasDownload)').is(':checked')) {
orderNoteDownloadId = $("#@Html.IdFor(model => model.AddOrderNoteDownloadId)").val();
}
var orderNoteDisplayToCustomer = $("#@Html.IdFor(model => model.AddOrderNoteDisplayToCustomer)").is(':checked');
$('#addOrderNote').attr('disabled', true);
var postData = {
DisplayToCustomer: orderNoteDisplayToCustomer,
message: orderNoteMessage,
downloadId: orderNoteDownloadId,
orderId: '@Model.Id'
};
addAntiForgeryToken(postData);
$.ajax({
cache:false,
type: "POST",
url: "@(Url.Action("OrderNoteAdd", "Order", new { area = area }))",
data: postData,
success: function (data) {
var grid = GrandAdmin.grids.get("#ordernotes-grid");
grid.dataSource.read();
$('#addOrderNote').attr('disabled', false);
},
error:function (xhr, ajaxOptions, thrownError){
alert('Failed to add order note.');
$('#addOrderNote').attr('disabled', false);
}
});
});
});
</script>