-
Notifications
You must be signed in to change notification settings - Fork 467
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added vendor data edit capability to the vendor portal
- Loading branch information
support
committed
Nov 15, 2023
1 parent
8d18b15
commit 730b2d8
Showing
17 changed files
with
1,105 additions
and
6 deletions.
There are no files selected for viewing
222 changes: 222 additions & 0 deletions
222
src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/EditorTemplates/Address.cshtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,222 @@ | ||
@model AddressModel | ||
@if (Model.CountryEnabled && Model.StateProvinceEnabled) | ||
{ | ||
<script> | ||
$(document).ready(function() { | ||
$("#@Html.IdFor(model => model.CountryId)").change(function() { | ||
var selectedItem = $(this).val(); | ||
var ddlStates = $("#@Html.IdFor(model => model.StateProvinceId)"); | ||
$.ajax({ | ||
cache: false, | ||
type: "GET", | ||
url: "@(Url.Action("GetStatesByCountryId", "Home"))", | ||
data: { "countryId": selectedItem, "addSelectStateItem": "false" }, | ||
success: function(data) { | ||
ddlStates.html(''); | ||
$.each(data, function(id, option) { | ||
ddlStates.append($('<option></option>').val(option.id).html(option.name)); | ||
}); | ||
}, | ||
error: function(xhr, ajaxOptions, thrownError) { | ||
alert('Failed to retrieve states.'); | ||
} | ||
}); | ||
}); | ||
}); | ||
</script> | ||
} | ||
<input asp-for="Id" type="hidden" /> | ||
<input asp-for="FirstNameEnabled" type="hidden" /> | ||
<input asp-for="FirstNameRequired" type="hidden" /> | ||
<input asp-for="LastNameEnabled" type="hidden" /> | ||
<input asp-for="LastNameRequired" type="hidden" /> | ||
<input asp-for="EmailEnabled" type="hidden" /> | ||
<input asp-for="EmailRequired" type="hidden" /> | ||
<input asp-for="CompanyEnabled" type="hidden" /> | ||
<input asp-for="CompanyRequired" type="hidden" /> | ||
<input asp-for="VatNumberEnabled" type="hidden" /> | ||
<input asp-for="VatNumberRequired" type="hidden" /> | ||
<input asp-for="CountryEnabled" type="hidden" /> | ||
<input asp-for="StateProvinceEnabled" type="hidden" /> | ||
<input asp-for="CityEnabled" type="hidden" /> | ||
<input asp-for="CityRequired" type="hidden" /> | ||
<input asp-for="StreetAddressEnabled" type="hidden" /> | ||
<input asp-for="StreetAddressRequired" type="hidden" /> | ||
<input asp-for="StreetAddress2Enabled" type="hidden" /> | ||
<input asp-for="StreetAddress2Required" type="hidden" /> | ||
<input asp-for="ZipPostalCodeEnabled" type="hidden" /> | ||
<input asp-for="ZipPostalCodeRequired" type="hidden" /> | ||
<input asp-for="PhoneEnabled" type="hidden" /> | ||
<input asp-for="PhoneRequired" type="hidden" /> | ||
<input asp-for="FaxEnabled" type="hidden" /> | ||
<input asp-for="FaxRequired" type="hidden" /> | ||
<input asp-for="NoteEnabled" type="hidden" /> | ||
|
||
<div class="form-horizontal"> | ||
<div class="form-body"> | ||
@if (Model.NameEnabled) | ||
{ | ||
<div class="form-group"> | ||
<admin-label asp-for="Name" /> | ||
<div class="col-md-9 col-sm-9"> | ||
<admin-input asp-for="Name" /> | ||
<span asp-validation-for="Name"></span> | ||
</div> | ||
</div> | ||
} | ||
@if (Model.FirstNameEnabled) | ||
{ | ||
<div class="form-group"> | ||
<admin-label asp-for="FirstName" /> | ||
<div class="col-md-9 col-sm-9"> | ||
<admin-input asp-for="FirstName" /> | ||
<span asp-validation-for="FirstName"></span> | ||
</div> | ||
</div> | ||
} | ||
@if (Model.LastNameEnabled) | ||
{ | ||
<div class="form-group"> | ||
<admin-label asp-for="LastName" /> | ||
<div class="col-md-9 col-sm-9"> | ||
<admin-input asp-for="LastName" /> | ||
<span asp-validation-for="LastName"></span> | ||
</div> | ||
</div> | ||
} | ||
@if (Model.EmailEnabled) | ||
{ | ||
<div class="form-group"> | ||
<admin-label asp-for="Email" /> | ||
<div class="col-md-9 col-sm-9"> | ||
<admin-input asp-for="Email" /> | ||
<span asp-validation-for="Email"></span> | ||
</div> | ||
</div> | ||
} | ||
@if (Model.CompanyEnabled) | ||
{ | ||
<div class="form-group"> | ||
<admin-label asp-for="Company" /> | ||
<div class="col-md-9 col-sm-9"> | ||
<admin-input asp-for="Company" /> | ||
<span asp-validation-for="Company"></span> | ||
</div> | ||
</div> | ||
} | ||
@if (Model.VatNumberEnabled) | ||
{ | ||
<div class="form-group"> | ||
<admin-label asp-for="VatNumber" /> | ||
<div class="col-md-9 col-sm-9"> | ||
<admin-input asp-for="VatNumber" /> | ||
<span asp-validation-for="VatNumber"></span> | ||
</div> | ||
</div> | ||
} | ||
@if (Model.CountryEnabled) | ||
{ | ||
<div class="form-group"> | ||
<admin-label asp-for="CountryId" /> | ||
<div class="col-md-9 col-sm-9"> | ||
<admin-select asp-for="CountryId" asp-items="Model.AvailableCountries" /> | ||
<span asp-validation-for="CountryId"></span> | ||
</div> | ||
</div> | ||
} | ||
@if (Model.CountryEnabled && Model.StateProvinceEnabled) | ||
{ | ||
<div class="form-group"> | ||
<admin-label asp-for="StateProvinceId" /> | ||
<div class="col-md-9 col-sm-9"> | ||
<admin-select asp-for="StateProvinceId" asp-items="Model.AvailableStates" /> | ||
<span asp-validation-for="StateProvinceId"></span> | ||
</div> | ||
</div> | ||
} | ||
@if (Model.CityEnabled) | ||
{ | ||
<div class="form-group"> | ||
<admin-label asp-for="City" /> | ||
<div class="col-md-9 col-sm-9"> | ||
<admin-input asp-for="City" /> | ||
<span asp-validation-for="City"></span> | ||
</div> | ||
</div> | ||
} | ||
@if (Model.StreetAddressEnabled) | ||
{ | ||
<div class="form-group"> | ||
<admin-label asp-for="Address1" /> | ||
<div class="col-md-9 col-sm-9"> | ||
<admin-input asp-for="Address1" /> | ||
<span asp-validation-for="Address1"></span> | ||
</div> | ||
</div> | ||
} | ||
@if (Model.StreetAddress2Enabled) | ||
{ | ||
<div class="form-group"> | ||
<admin-label asp-for="Address2" /> | ||
<div class="col-md-9 col-sm-9"> | ||
<admin-input asp-for="Address2" /> | ||
<span asp-validation-for="Address2"></span> | ||
</div> | ||
</div> | ||
} | ||
@if (Model.ZipPostalCodeEnabled) | ||
{ | ||
<div class="form-group"> | ||
<admin-label asp-for="ZipPostalCode" /> | ||
<div class="col-md-9 col-sm-9"> | ||
<admin-input asp-for="ZipPostalCode" /> | ||
<span asp-validation-for="ZipPostalCode"></span> | ||
</div> | ||
</div> | ||
} | ||
@if (Model.PhoneEnabled) | ||
{ | ||
<div class="form-group"> | ||
<admin-label asp-for="PhoneNumber" /> | ||
<div class="col-md-9 col-sm-9"> | ||
<admin-input asp-for="PhoneNumber" /> | ||
<span asp-validation-for="PhoneNumber"></span> | ||
</div> | ||
</div> | ||
} | ||
@if (Model.FaxEnabled) | ||
{ | ||
<div class="form-group"> | ||
<admin-label asp-for="FaxNumber" /> | ||
<div class="col-md-9 col-sm-9"> | ||
<admin-input asp-for="FaxNumber" /> | ||
<span asp-validation-for="FaxNumber"></span> | ||
</div> | ||
</div> | ||
} | ||
@if (Model.NoteEnabled) | ||
{ | ||
<div class="form-group"> | ||
<admin-label asp-for="Note" /> | ||
<div class="col-md-9 col-sm-9"> | ||
<admin-input asp-for="Note" /> | ||
<span asp-validation-for="Note"></span> | ||
</div> | ||
</div> | ||
} | ||
@if (Model.AddressTypeEnabled) | ||
{ | ||
<div class="form-group"> | ||
<admin-label asp-for="AddressType" /> | ||
<div class="col-md-9 col-sm-9"> | ||
<select asp-for="AddressType" asp-items="@AddressType.Any.ToSelectList(Context, false).ToList()" class="form-control custom-select"></select> | ||
<span asp-validation-for="AddressType"></span> | ||
</div> | ||
</div> | ||
} | ||
@if (Model.CustomAddressAttributes.Count > 0) | ||
{ | ||
<partial name="Partials/AddressAttributes" model="Model.CustomAddressAttributes" /> | ||
} | ||
</div> | ||
</div> |
74 changes: 74 additions & 0 deletions
74
src/Web/Grand.Web.Vendor/Areas/Vendor/Views/Shared/Partials/AddressAttributes.cshtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
@model IList<AddressModel.AddressAttributeModel> | ||
@foreach (var attribute in Model) | ||
{ | ||
var controlId = $"attributes[{attribute.Id}]"; | ||
var textPrompt = attribute.Name; | ||
|
||
<div class="form-group"> | ||
<label class="control-label col-md-3">@textPrompt</label> | ||
<div class="col-md-9 col-sm-9"> | ||
@switch (attribute.AttributeControlType) | ||
{ | ||
case AttributeControlType.DropdownList: | ||
{ | ||
<select class="form-control" name="@(controlId)" id="@(controlId)"> | ||
@if (!attribute.IsRequired) | ||
{ | ||
<option value="">---</option> | ||
} | ||
@foreach (var attributeValue in attribute.Values) | ||
{ | ||
<option selected="@attributeValue.IsPreSelected" value="@attributeValue.Id">@attributeValue.Name</option> | ||
} | ||
</select> | ||
} | ||
break; | ||
case AttributeControlType.RadioList: | ||
{ | ||
<div class="radio-list"> | ||
@foreach (var attributeValue in attribute.Values) | ||
{ | ||
<div> | ||
<input id="@(controlId)_@(attributeValue.Id)" type="radio" name="@(controlId)" value="@attributeValue.Id" checked="@attributeValue.IsPreSelected" /> | ||
<label for="@(controlId)_@(attributeValue.Id)">@attributeValue.Name</label> | ||
</div> | ||
} | ||
</div> | ||
} | ||
break; | ||
case AttributeControlType.Checkboxes: | ||
case AttributeControlType.ReadonlyCheckboxes: | ||
{ | ||
<div class="checkbox-list"> | ||
@foreach (var attributeValue in attribute.Values) | ||
{ | ||
<div> | ||
<input id="@(controlId)_@(attributeValue.Id)" type="checkbox" name="@(controlId)" value="@(attributeValue.Id)" checked="@(attributeValue.IsPreSelected)" @(attribute.AttributeControlType == AttributeControlType.ReadonlyCheckboxes ? Html.Raw(" disabled=\"disabled\"") : null) /> | ||
<label for="@(controlId)_@(attributeValue.Id)">@attributeValue.Name</label> | ||
</div> | ||
} | ||
</div> | ||
} | ||
break; | ||
case AttributeControlType.TextBox: | ||
{ | ||
<input name="@(controlId)" type="text" class="form-control text-box single-line" id="@(controlId)" value="@(attribute.DefaultValue)" /> | ||
} | ||
break; | ||
case AttributeControlType.MultilineTextbox: | ||
{ | ||
<textarea id="@(controlId)" style="Width: 250px; Height: 150px;" name="@(controlId)">@(attribute.DefaultValue)</textarea> | ||
} | ||
break; | ||
case AttributeControlType.Datepicker: | ||
case AttributeControlType.FileUpload: | ||
case AttributeControlType.ColorSquares: | ||
case AttributeControlType.ImageSquares: | ||
{ | ||
//not support attribute type | ||
} | ||
break; | ||
} | ||
</div> | ||
</div> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
src/Web/Grand.Web.Vendor/Areas/Vendor/Views/VendorInfo/Edit.cshtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
@model VendorModel | ||
@{ | ||
//page title | ||
ViewBag.Title = Loc["Vendor.EditVendorDetails"]; | ||
} | ||
<form asp-area="@Constants.AreaVendor" asp-controller="VendorInfo" asp-action="Edit" method="post"> | ||
|
||
<div class="row"> | ||
<div class="col-md-12"> | ||
<div class="x_panel light form-fit"> | ||
<div class="x_title"> | ||
<div class="caption"> | ||
<i class="fa fa-cube"></i> | ||
@Loc["Vendor.EditVendorDetails"] - @Model.Name | ||
</div> | ||
<div class="actions"> | ||
<div class="btn-group btn-group-devided"> | ||
<button class="btn btn-success" type="submit" name="save"><i class="fa fa-check"></i> @Loc["Vendor.Common.Save"] </button> | ||
<vc:vendor-widget widget-zone="vendor_vendor_details_buttons" additional-data="Model" /> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="x_content form"> | ||
<partial name="Partials/CreateOrUpdate" model="Model" /> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</form> |
Oops, something went wrong.