Michele: aggiunta nuova destinazione, scrive su tabella pimodgir
This commit is contained in:
parent
2e379fcb81
commit
bae628ed8e
208
Controllers/AddDestinazioneController.cs
Normal file
208
Controllers/AddDestinazioneController.cs
Normal file
@ -0,0 +1,208 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||
using Newtonsoft.Json;
|
||||
using SoftwayWeb.Models;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
|
||||
|
||||
namespace SoftwayWeb.Controllers
|
||||
{
|
||||
public class AddDestinazioneController : Controller
|
||||
{
|
||||
|
||||
string apiUrl = string.Empty;
|
||||
string urlBase = string.Empty;
|
||||
string token = string.Empty;
|
||||
string errMes = string.Empty;
|
||||
private readonly IConfiguration _configuration;
|
||||
HttpClient client;
|
||||
SessionHelper helper;
|
||||
|
||||
public AddDestinazioneController(IConfiguration configuration)
|
||||
{
|
||||
_configuration = configuration;
|
||||
client = new HttpClient();
|
||||
var key = _configuration["ApplicationInsights:rootUrlApi"];
|
||||
apiUrl = key;
|
||||
}
|
||||
|
||||
public IActionResult AddDestinazione(string serialeGiro)
|
||||
{
|
||||
SessionHelper helper = new SessionHelper(this);
|
||||
|
||||
token = helper.GetStringValue("tok");
|
||||
|
||||
if (string.IsNullOrEmpty(token))
|
||||
{
|
||||
return RedirectToAction("Login", "Login");
|
||||
}
|
||||
|
||||
ViewBag.Commit = getCommittenti();
|
||||
|
||||
return View();
|
||||
}
|
||||
|
||||
public IActionResult NewDestinazione(Modgir modgir)
|
||||
{
|
||||
SessionHelper helper = new SessionHelper(this);
|
||||
|
||||
token = helper.GetStringValue("tok");
|
||||
|
||||
if (string.IsNullOrEmpty(token))
|
||||
{
|
||||
return RedirectToAction("Login", "Login");
|
||||
}
|
||||
|
||||
//qui metodo post per scrivere su pimodgir
|
||||
Modgir mg = new Modgir();
|
||||
|
||||
mg.Piprogre = modgir.Piprogre;
|
||||
mg.Piserial = modgir.Piserial;
|
||||
mg.Pidata = modgir.Pidata;
|
||||
mg.Picommit = modgir.Picommit;
|
||||
mg.Pidesdiv = modgir.Pidesdiv;
|
||||
mg.Pitarga = modgir.Pitarga;
|
||||
mg.Piautist = modgir.Piautist;
|
||||
mg.Pitiprec = "M";
|
||||
mg.Pirigele = modgir.Pirigele;
|
||||
mg.Pisergir = modgir.Pisergir;
|
||||
|
||||
apiUrl = helper.GetStringValue("apiUrl");
|
||||
|
||||
urlBase = apiUrl + "ModificaGiro/addModgir";
|
||||
Uri baseAddress = new Uri(urlBase);
|
||||
client = new HttpClient();
|
||||
client.BaseAddress = baseAddress;
|
||||
|
||||
string data = JsonConvert.SerializeObject(mg);
|
||||
StringContent content = new StringContent(data, Encoding.UTF8, "application/json");
|
||||
HttpResponseMessage response = client.PostAsync(baseAddress, content).Result;
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
return RedirectToAction("Index","Giri");
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
errMes = response.Content.ReadAsStringAsync().Result;
|
||||
helper.SetStringValue("errMsg", errMes);
|
||||
return RedirectToAction("Error");
|
||||
}
|
||||
//return View();
|
||||
}
|
||||
|
||||
public IActionResult Index()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
#region METODI INTERNI
|
||||
|
||||
private List<SelectListItem> getCommittenti()
|
||||
{
|
||||
SessionHelper helper = new SessionHelper(this);
|
||||
|
||||
token = helper.GetStringValue("tok");
|
||||
apiUrl = helper.GetStringValue("apiUrl");
|
||||
urlBase = apiUrl + "Clienti/getCommittenti";
|
||||
|
||||
Uri baseAddress = new Uri(urlBase);
|
||||
client = new HttpClient();
|
||||
client.BaseAddress = baseAddress;
|
||||
List<SelectListItem> selectItems = new List<SelectListItem>();
|
||||
List<Clienti> listClienti = new List<Clienti>();
|
||||
HttpResponseMessage response = client.GetAsync(baseAddress).Result;
|
||||
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
string data = response.Content.ReadAsStringAsync().Result;
|
||||
listClienti = JsonConvert.DeserializeObject<List<Clienti>>(data);
|
||||
|
||||
//per gestire primo elemento tendina (deve essere vuoto)
|
||||
SelectListItem listItemFirst = new SelectListItem();
|
||||
|
||||
listItemFirst.Value = string.Empty;
|
||||
listItemFirst.Text = " - Seleziona Committente";
|
||||
selectItems.Add(listItemFirst);
|
||||
|
||||
foreach (var item in listClienti)
|
||||
{
|
||||
SelectListItem listItem = new SelectListItem();
|
||||
|
||||
string s = item.Ancodice + " - " + item.Andescri;
|
||||
listItem.Value = item.Ancodice;
|
||||
listItem.Text = s;
|
||||
selectItems.Add(listItem);
|
||||
}
|
||||
}
|
||||
|
||||
return selectItems;
|
||||
}
|
||||
|
||||
|
||||
#endregion METODI INTERNI
|
||||
|
||||
#region CASCADING
|
||||
|
||||
public IActionResult Cascading()
|
||||
{
|
||||
Cascading model = new Cascading();
|
||||
model.Committenti = getCommittenti();
|
||||
return View(model);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult Cascading(string Picommit/*ancodice*/)
|
||||
{
|
||||
SessionHelper helper = new SessionHelper(this);
|
||||
Cascading model = new Cascading();
|
||||
model.Committenti = getCommittenti();
|
||||
|
||||
if (!string.IsNullOrEmpty(Picommit))
|
||||
{
|
||||
token = helper.GetStringValue("tok");
|
||||
apiUrl = helper.GetStringValue("apiUrl");
|
||||
urlBase = apiUrl + "Clienti/getSediByCommittente"+ "?codCom=" + Picommit;
|
||||
|
||||
Uri baseAddress = new Uri(urlBase);
|
||||
client = new HttpClient();
|
||||
client.BaseAddress = baseAddress;
|
||||
|
||||
List<SedeConsegna> sediCons = new List<SedeConsegna>();
|
||||
List<SelectListItem> selectItems = new List<SelectListItem>();
|
||||
//List<SedeConsegna> listSedi = new List<SedeConsegna>();
|
||||
HttpResponseMessage response = client.GetAsync(baseAddress).Result;
|
||||
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
string data = response.Content.ReadAsStringAsync().Result;
|
||||
sediCons = JsonConvert.DeserializeObject<List<SedeConsegna>>(data);
|
||||
|
||||
SelectListItem listItemFirst = new SelectListItem();
|
||||
|
||||
listItemFirst.Value = string.Empty;
|
||||
listItemFirst.Text = " - Seleziona sede";
|
||||
selectItems.Add(listItemFirst);
|
||||
|
||||
foreach (var sede in sediCons)
|
||||
{
|
||||
SelectListItem listItem = new SelectListItem();
|
||||
|
||||
string s = sede.Pccodsed + " - " + sede.Pcdescri;
|
||||
listItem.Value = sede.Pccodsed;
|
||||
listItem.Text = s;
|
||||
selectItems.Add(listItem);
|
||||
//model.SediCons.Add(listItem);
|
||||
model.SediCons.Add(listItem);
|
||||
}
|
||||
//model.SediCons.AddRange(selectItems);
|
||||
ViewBag.SediCons = sediCons;
|
||||
}
|
||||
}
|
||||
return Json(new SelectList(model.SediCons, "Value", "Text"));
|
||||
}
|
||||
|
||||
#endregion CASCADING
|
||||
}
|
||||
}
|
||||
19
Models/Cascading.cs
Normal file
19
Models/Cascading.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||
|
||||
namespace SoftwayWeb.Models
|
||||
{
|
||||
public class Cascading
|
||||
{
|
||||
public Cascading()
|
||||
{
|
||||
this.Committenti = new List<SelectListItem> ();
|
||||
this.SediCons = new List<SelectListItem> ();
|
||||
}
|
||||
|
||||
public List<SelectListItem> Committenti { get; set; }
|
||||
public List<SelectListItem> SediCons { get; set; }
|
||||
|
||||
public string? ancodice { get; set; }
|
||||
public string? pccodsed { get; set; }
|
||||
}
|
||||
}
|
||||
11
Models/Clienti.cs
Normal file
11
Models/Clienti.cs
Normal file
@ -0,0 +1,11 @@
|
||||
namespace SoftwayWeb.Models
|
||||
{
|
||||
public class Clienti
|
||||
{
|
||||
public string? Antipcon { get; set; }
|
||||
public string? Ancodice { get; set; }
|
||||
public string? Andescri { get; set; }
|
||||
public string? ancodfis { get; set; }
|
||||
public string? anpariva { get; set; }
|
||||
}
|
||||
}
|
||||
@ -1,16 +1,27 @@
|
||||
namespace SoftwayWeb.Models
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace SoftwayWeb.Models
|
||||
{
|
||||
public class Modgir
|
||||
{
|
||||
[Display(Name = "Progressivo")]
|
||||
public string? Piprogre { get; set; }
|
||||
[Display(Name = "Seriale destinazione")]
|
||||
public string? Piserial { get; set; }
|
||||
[Display(Name = "Data")]
|
||||
public DateTime? Pidata { get; set; }
|
||||
[Display(Name = "Committente")]
|
||||
public string? Picommit { get; set; }
|
||||
[Display(Name = "Sede")]
|
||||
public string? Pidesdiv { get; set; }
|
||||
[Display(Name = "Cod. Automezzo")]
|
||||
public string? Pitarga { get; set; }
|
||||
[Display(Name = "Autitsta")]
|
||||
public string? Piautist { get; set; }
|
||||
[Display(Name = "Tipo")]
|
||||
public string? Pitiprec { get; set; }
|
||||
public string? Pirigele { get; set; }
|
||||
[Display(Name = "Seriale Giro")]
|
||||
public string? Pisergir { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
26
Models/SedeConsegna.cs
Normal file
26
Models/SedeConsegna.cs
Normal file
@ -0,0 +1,26 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace SoftwayWeb.Models
|
||||
{
|
||||
public class SedeConsegna
|
||||
{
|
||||
[Display(Name = "Tipo conto")]
|
||||
public string? Pctipcon { get; set; }
|
||||
|
||||
[Display(Name = "Cod. Committente")]
|
||||
public string? Pccodcon { get; set; }
|
||||
|
||||
public int? Cprownum { get; set; }
|
||||
|
||||
public int? Cproword { get; set; }
|
||||
[Display(Name = "Cod. Sede")]
|
||||
public string? Pccodsed { get; set; }
|
||||
|
||||
[Display(Name = "Sede")]
|
||||
public string? Pcdescri { get; set; }
|
||||
|
||||
[Display(Name = "Indirizzo")]
|
||||
public string? Pcindiri { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
131
Views/AddDestinazione/AddDestinazione.cshtml
Normal file
131
Views/AddDestinazione/AddDestinazione.cshtml
Normal file
@ -0,0 +1,131 @@
|
||||
@model SoftwayWeb.Models.Modgir
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "AddDestinazione";
|
||||
Layout = "~/Views/Shared/_LayoutAreaRis.cshtml";
|
||||
@ViewBag.SediCons
|
||||
}
|
||||
|
||||
<h1>Aggiungi una nuova destinazione</h1>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xl">
|
||||
<div class="card mb-4">
|
||||
<div class="card-header d-flex justify-content-between align-items-center">
|
||||
<h5 class="mb-0">Nuova destinazione</h5> <small class="text-muted float-end"></small>
|
||||
</div>
|
||||
@* @using (Html.BeginForm("AddDestinazione", "AddDestinazione", FormMethod.Post))
|
||||
{ *@
|
||||
|
||||
@* <div class="mb-3">
|
||||
<b>Seleziona il Committente: </b>@Html.DropDownListFor(x => x.Picommit, (IEnumerable<SelectListItem>)ViewBag.Commit, new { @id = "ddlCommittenti", @class = "agy-form-field require" }) *@
|
||||
@* @Html.DropDownList("Committente", ViewBag.Committente, null, new { @class = "agy-form-field require" }) *@
|
||||
@* </div>
|
||||
<div class="mb-3">
|
||||
<b>Seleziona una sede: </b>@Html.DropDownListFor(x => x.Pidesdiv, new List<SelectListItem>(), "Seleziona sede", new { @id = "ddlSediCons", @class = "agy-form-field require" }) *@
|
||||
@* @Html.DropDownList("Sede", ViewBag.Sede, null, new {class = "agy-form-field require"}) *@
|
||||
@* </div> *@
|
||||
|
||||
<div class="card-body">
|
||||
<form asp-action="AggiungiDestinazione">
|
||||
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
|
||||
<div class="mb-3">
|
||||
<b><label asp-for="Picommit" class="control-label"></label></b>
|
||||
<div>
|
||||
@Html.DropDownListFor(x => x.Picommit, (IEnumerable<SelectListItem>)ViewBag.Commit, new { @id = "ddlCommittenti", @class = "agy-form-field require" })
|
||||
</div><span asp-validation-for="Picommit" class="text-danger"></span>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<b><label asp-for="Pidesdiv" class="control-label"></label></b>
|
||||
<div id="District">
|
||||
@Html.DropDownListFor(x => x.Pidesdiv, new List<SelectListItem>(), "- Seleziona sede", new { @id = "ddlSediCons", @class = "agy-form-field require" })
|
||||
</div>
|
||||
<span asp-validation-for="Pidesdiv" class="text-danger"></span>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<b><label asp-for="Piprogre" class="control-label"></label></b>
|
||||
<input asp-for="Piprogre" class="form-control" />
|
||||
<span asp-validation-for="Piprogre" class="text-danger"></span>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<b><label asp-for="Piserial" class="control-label"></label></b>
|
||||
<input asp-for="Piserial" class="form-control" />
|
||||
<span asp-validation-for="Piserial" class="text-danger"></span>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<b><label asp-for="Pidata" class="control-label"></label></b>
|
||||
<input asp-for="Pidata" class="form-control" />
|
||||
<span asp-validation-for="Pidata" class="text-danger"></span>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<b><label asp-for="Pitarga" class="control-label"></label></b>
|
||||
<input asp-for="Pitarga" class="form-control" />
|
||||
<span asp-validation-for="Pitarga" class="text-danger"></span>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<b><label asp-for="Piautist" class="control-label"></label></b>
|
||||
<input asp-for="Piautist" class="form-control" />
|
||||
<span asp-validation-for="Piautist" class="text-danger"></span>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<b><label asp-for="Pitiprec" class="control-label"></label></b>
|
||||
<input asp-for="Pitiprec" class="form-control" />
|
||||
<span asp-validation-for="Pitiprec" class="text-danger"></span>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<b><label asp-for="Pirigele" class="control-label"></label></b>
|
||||
<input asp-for="Pirigele" class="form-control" />
|
||||
<span asp-validation-for="Pirigele" class="text-danger"></span>
|
||||
</div>
|
||||
@* <div class="mb-3">
|
||||
<label class="form-label" for="basic-default-fullname"><b>@Html.DisplayNameFor(model => model.Pirigele)</b> </label>
|
||||
<div class="form-text">@Html.DisplayFor(model => model.Pirigele)</div>
|
||||
</div> *@
|
||||
<div class="mb-3">
|
||||
<b><label asp-for="Pisergir" class="control-label"></label></b>
|
||||
<input asp-for="Pisergir" class="form-control" />
|
||||
<span asp-validation-for="Pisergir" class="text-danger"></span>
|
||||
</div>
|
||||
<div>
|
||||
<input type="submit" asp-controller="AddDestinazione" asp-action="NewDestinazione" value="Salva modifiche" class="btn btn-primary" />
|
||||
<a asp-action="Index" asp-controller="Giri" value="Torna alla lista" class="btn btn-primary">Torna alla lista</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@* } *@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@section Scripts {
|
||||
@{
|
||||
await Html.RenderPartialAsync("_ValidationScriptsPartial");
|
||||
}
|
||||
}
|
||||
|
||||
<hr />
|
||||
<script src="~/js/jquery.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
$('#ddlCommittenti').change(function () {
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: "/AddDestinazione/Cascading",
|
||||
data: { Picommit: $('#ddlCommittenti').val() },
|
||||
datatype: "json",
|
||||
traditional: true,
|
||||
success: function (states) {
|
||||
var district = "<select id='ddlSediCons' class='form-control' name='Pidesdiv'>";
|
||||
district = district + '<option value="">- Seleziona sede</option>';
|
||||
for (var i = 0; i < states.length; i++) {
|
||||
district = district + 'option value="' + states[i].value + '">' + states[i].text + '</option>';
|
||||
}
|
||||
district = district + '</select>';
|
||||
$('#District').html(district);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
91
Views/AddDestinazione/Cascading.cshtml
Normal file
91
Views/AddDestinazione/Cascading.cshtml
Normal file
@ -0,0 +1,91 @@
|
||||
@model SoftwayWeb.Models.Cascading
|
||||
|
||||
|
||||
|
||||
@{
|
||||
// ViewData["Title"] = "Cascading";
|
||||
Layout = null;
|
||||
}
|
||||
|
||||
@* <h1>Cascading</h1> *@
|
||||
|
||||
<script src="~/assets/js/jquery.min.js"></script>
|
||||
|
||||
<h2>Cascading DropdownList</h2>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<label>Committente</label>
|
||||
</td>
|
||||
<td>
|
||||
@Html.DropDownListFor(x => x.ancodice, Model.Committenti, "--Select--", new { @id = "ddlCommittenti" })
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label>Sede consegna</label>
|
||||
</td>
|
||||
<td id="District">
|
||||
@Html.DropDownListFor(x => x.pccodsed, new List<SelectListItem>(), "--Select--", new {@id = "ddlSediCons"})
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@* <script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
$('#ddlCommittenti').change(function () {
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: "/CommesseVT/Cascading",
|
||||
data: { ancodice: $('#ddlCommittenti').val() },
|
||||
datatype: "json",
|
||||
traditional: true,
|
||||
success: function (states) {
|
||||
|
||||
//alert(states.length);
|
||||
//alert(JSON.stringify(states));
|
||||
|
||||
var district = "<select id='ddlSediCons' class='form-control'>";
|
||||
district = district + '<option value="">--Seleziona--</option>';
|
||||
for (var i = 0; i < states.length; i++) {
|
||||
district = district + '<option value="' + states[i].value + '">' + states[i].text + '</option>';
|
||||
//alert(states[i].text);
|
||||
//alert(states[i].value);
|
||||
//alert(district);
|
||||
}
|
||||
|
||||
district = district + '</select>';
|
||||
alert(district);
|
||||
$('#District').html(district);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script> *@
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
$('#ddlCommittenti').change(function () {
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url:"/AddDestinazione/Cascading",
|
||||
data: {ancodice: $('#ddlCommittenti').val()},
|
||||
datatype: "json",
|
||||
traditional: true,
|
||||
success: function (states) {
|
||||
var district = "<select id='ddlSediCons' class='form-control'>";
|
||||
district = district + '<option value="">--Seleziona--</option>';
|
||||
for (var i = 0; i < states.length; i++) {
|
||||
district = district + '<option value="' + states[i].value + '">' + states[i].text + '<option>';
|
||||
}
|
||||
district = district + '</select>';
|
||||
alert(district);
|
||||
$('#District').html(district);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
@ -126,6 +126,7 @@
|
||||
nomeMezzo = item.Automezzo,
|
||||
dataGiroCons = item.DataGiro@* id=item.SerialeGiro,nbanc=item.parzialeBanRec,imp=item.parzialeImpRec *@ })" title="Modifica tutte le destinazioni" class="links"><img alt="Modifica Tutte" src="@Url.Content("~/images/system.png")" style="width:24px;height:24px;">
|
||||
</a>
|
||||
<a href="@Url.ActionLink("AddDestinazione", "AddDestinazione", new{serialeGiro = item.SerialeGiro})" title="Aggiungi nuova destinazione" class="links"><img alt="Aggiungi nuova destinazione" src="@Url.Content("~/images/addBtn.png")" style="width:25px;height:25px;"></a>
|
||||
@if (item.BancaliCaricati == null)
|
||||
{
|
||||
<img alt="noBancali" src="@Url.Content("~/images/alert.png")" style="width:23px;height:23px;">
|
||||
|
||||
BIN
wwwroot/images/addBtn.png
Normal file
BIN
wwwroot/images/addBtn.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.0 KiB |
1
wwwroot/js/SmoothScroll.min.js
vendored
Normal file
1
wwwroot/js/SmoothScroll.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
7
wwwroot/js/bootstrap.bundle.min.js
vendored
Normal file
7
wwwroot/js/bootstrap.bundle.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
529
wwwroot/js/custom.js
Normal file
529
wwwroot/js/custom.js
Normal file
@ -0,0 +1,529 @@
|
||||
/*--------------------- Copyright (c) 2022 -----------------------
|
||||
[Master Javascript]
|
||||
Project: Business Agency - Responsive HTML Template
|
||||
Version: 1.0.0
|
||||
Assigned to:
|
||||
-------------------------------------------------------------------*/
|
||||
(function($) {
|
||||
"use strict";
|
||||
/*-----------------------------------------------------
|
||||
Function Start
|
||||
-----------------------------------------------------*/
|
||||
var Agency = {
|
||||
initialised: false,
|
||||
version: 1.0,
|
||||
mobile: false,
|
||||
init: function() {
|
||||
if (!this.initialised) {
|
||||
this.initialised = true;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------
|
||||
Function Calling
|
||||
-----------------------------------------------------*/
|
||||
this.preLoader();
|
||||
this.searchBar();
|
||||
this.wowAnimation();
|
||||
this.navMenu();
|
||||
this.focusText();
|
||||
this.testimonialSlider();
|
||||
this.TeamSlider();
|
||||
this.partner();
|
||||
this.counter();
|
||||
this.topButton();
|
||||
this.aboutTabs();
|
||||
this.tiltAnimation();
|
||||
this.popupGallery();
|
||||
this.cursor();
|
||||
},
|
||||
/*-----------------------------------------------------
|
||||
Fix Preloader
|
||||
-----------------------------------------------------*/
|
||||
preLoader: function() {
|
||||
$(window).on('load', function() {
|
||||
$(".preloader-wrapper").removeClass('preloader-active');
|
||||
});
|
||||
jQuery(window).on('load', function() {
|
||||
setTimeout(function() {
|
||||
jQuery('.preloader-open').addClass('loaded');
|
||||
}, 100);
|
||||
});
|
||||
},
|
||||
|
||||
/*-----------------------------------------------------
|
||||
Fix Search Bar & Cart
|
||||
-----------------------------------------------------*/
|
||||
searchBar: function() {
|
||||
$('.searchBtn').on("click", function() {
|
||||
$('.search-bar').addClass('show');
|
||||
});
|
||||
$('.closeBtn').on("click", function() {
|
||||
$('.search-bar').removeClass('show');
|
||||
});
|
||||
$('.search-bar').on("click", function() {
|
||||
$('.search-bar').removeClass('show');
|
||||
});
|
||||
$(".search-bar-inner").on('click', function() {
|
||||
event.stopPropagation();
|
||||
});
|
||||
},
|
||||
|
||||
/*-----------------------------------------------------
|
||||
Fix Animation
|
||||
-----------------------------------------------------*/
|
||||
wowAnimation: function() {
|
||||
new WOW().init();
|
||||
},
|
||||
|
||||
/*-----------------------------------------------------
|
||||
Fix Mobile Menu
|
||||
-----------------------------------------------------*/
|
||||
navMenu: function() {
|
||||
var w = window.innerWidth;
|
||||
if (w <= 991) {
|
||||
/** Menu Btn Click**/
|
||||
$(".menu-btn").on('click', function(event) {
|
||||
event.stopPropagation();
|
||||
$(".main-menu-wrapper, .menu-btn-wrap").toggleClass("open");
|
||||
});
|
||||
$("body").on('click', function() {
|
||||
$(".main-menu-wrapper, .menu-btn-wrap").removeClass("open");
|
||||
});
|
||||
|
||||
/** Mobile Menus JS **/
|
||||
$(".main-menu-wrapper>ul li:has(ul)").addClass('has-submenu');
|
||||
$('.menu').on('click', '> li', function(e) {
|
||||
e.stopPropagation();
|
||||
$('.menu > li').not($(this)).find('.sub-menu').slideUp();
|
||||
$('.menu > li').not($(this)).removeClass('open');
|
||||
$(this).find('.sub-menu').slideToggle();
|
||||
$(this).toggleClass('open');
|
||||
});
|
||||
$(".main-menu-wrapper>ul").on('click', function(event) {
|
||||
event.stopPropagation();
|
||||
});
|
||||
|
||||
$(function() {
|
||||
for (var a = window.location, counting = $(".menu").filter(function() {
|
||||
return this.href == a;
|
||||
}).addClass("active").parent().addClass("active");;) {
|
||||
if (!counting.is("li")) break;
|
||||
counting = counting.parent().addClass("in").parent().addClass("active");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
/*-----------------------------------------------------
|
||||
Fix On focus Placeholder
|
||||
-----------------------------------------------------*/
|
||||
focusText: function() {
|
||||
var place = '';
|
||||
$('input,textarea').focus(function() {
|
||||
place = $(this).attr('placeholder');
|
||||
$(this).attr('placeholder', '');
|
||||
}).blur(function() {
|
||||
$(this).attr('placeholder', place);
|
||||
});
|
||||
},
|
||||
/*-----------------------------------------------------
|
||||
Fix Testimonial Slider
|
||||
-----------------------------------------------------*/
|
||||
testimonialSlider: function() {
|
||||
var testimonialSlider = new Swiper('.agy-testimonial-slider .swiper', {
|
||||
autoHeight: false,
|
||||
autoplay: false,
|
||||
loop: false,
|
||||
spaceBetween: 0,
|
||||
// effect: 'fade',
|
||||
centeredSlides: false,
|
||||
speed: 1500,
|
||||
pagination: {
|
||||
el: '.agy-testimonial-slider .agy-bullets',
|
||||
clickable: true,
|
||||
},
|
||||
navigation: {
|
||||
nextEl: '.agy-testimonial-slider .swiper-button-next',
|
||||
prevEl: '.agy-testimonial-slider .swiper-button-prev',
|
||||
},
|
||||
slidesPerView: 3,
|
||||
breakpoints: {
|
||||
0: {
|
||||
slidesPerView: 1,
|
||||
spaceBetween: 0,
|
||||
},
|
||||
575: {
|
||||
slidesPerView: 1,
|
||||
spaceBetween: 10,
|
||||
},
|
||||
767: {
|
||||
slidesPerView: 2,
|
||||
spaceBetween: 20,
|
||||
},
|
||||
992: {
|
||||
slidesPerView: 3,
|
||||
spaceBetween: 20,
|
||||
},
|
||||
1200: {
|
||||
slidesPerView: 3,
|
||||
spaceBetween: 30,
|
||||
},
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
/*-----------------------------------------------------
|
||||
Fix Team Slider
|
||||
-----------------------------------------------------*/
|
||||
TeamSlider: function() {
|
||||
var TeamSwiper = new Swiper('.team-slider.swiper', {
|
||||
autoHeight: false,
|
||||
autoplay: true,
|
||||
spaceBetween: 30,
|
||||
slidesPerView: 4,
|
||||
loop: true,
|
||||
speed: 3000,
|
||||
autoplay: {
|
||||
delay: 3000,
|
||||
},
|
||||
centeredSlides: false,
|
||||
breakpoints: {
|
||||
0: {
|
||||
slidesPerView: 1,
|
||||
},
|
||||
480: {
|
||||
slidesPerView: 1,
|
||||
},
|
||||
575: {
|
||||
slidesPerView: 2,
|
||||
spaceBetween: 20,
|
||||
},
|
||||
576: {
|
||||
slidesPerView: 2,
|
||||
spaceBetween: 20,
|
||||
},
|
||||
767: {
|
||||
slidesPerView: 2,
|
||||
spaceBetween: 20,
|
||||
},
|
||||
992: {
|
||||
slidesPerView: 3,
|
||||
spaceBetween: 20,
|
||||
},
|
||||
1200: {
|
||||
slidesPerView: 4,
|
||||
spaceBetween: 30,
|
||||
},
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
/*-----------------------------------------------------
|
||||
Fix Partner Slider
|
||||
-----------------------------------------------------*/
|
||||
partner: function() {
|
||||
var PartnerSwiper = new Swiper('.partner-slider.swiper', {
|
||||
autoHeight: false,
|
||||
autoplay: true,
|
||||
spaceBetween: 30,
|
||||
slidesPerView: 8,
|
||||
loop: true,
|
||||
speed: 2000,
|
||||
autoplay: {
|
||||
delay: 1000,
|
||||
},
|
||||
breakpoints: {
|
||||
0: {
|
||||
slidesPerView: 2,
|
||||
spaceBetween: 0,
|
||||
},
|
||||
575: {
|
||||
slidesPerView: 2,
|
||||
spaceBetween: 10,
|
||||
},
|
||||
767: {
|
||||
slidesPerView: 4,
|
||||
spaceBetween: 20,
|
||||
},
|
||||
992: {
|
||||
slidesPerView: 6,
|
||||
spaceBetween: 20,
|
||||
},
|
||||
1200: {
|
||||
slidesPerView: 6,
|
||||
spaceBetween: 30,
|
||||
},
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
/*-----------------------------------------------------
|
||||
Fix Counter
|
||||
-----------------------------------------------------*/
|
||||
counter: function() {
|
||||
if ($('.counter-holder').length > 0) {
|
||||
var a = 0;
|
||||
$(window).scroll(function() {
|
||||
var topScroll = $('.counter-holder').offset().top - window.innerHeight;
|
||||
if (a == 0 && $(window).scrollTop() > topScroll) {
|
||||
$('.count-no').each(function() {
|
||||
var $this = $(this),
|
||||
countTo = $this.attr('data-count');
|
||||
$({
|
||||
countNum: $this.text()
|
||||
}).animate({
|
||||
countNum: countTo
|
||||
}, {
|
||||
duration: 5000,
|
||||
easing: 'swing',
|
||||
step: function() {
|
||||
$this.text(Math.floor(this.countNum));
|
||||
},
|
||||
complete: function() {
|
||||
$this.text(this.countNum);
|
||||
}
|
||||
});
|
||||
});
|
||||
a = 1;
|
||||
}
|
||||
});
|
||||
};
|
||||
},
|
||||
|
||||
/*-----------------------------------------------------
|
||||
Fix GoToTopButton
|
||||
-----------------------------------------------------*/
|
||||
topButton: function() {
|
||||
var scrollTop = $(".agy-scroll-top");
|
||||
$(window).on('scroll', function() {
|
||||
if ($(this).scrollTop() < 500) {
|
||||
scrollTop.removeClass("active");
|
||||
} else {
|
||||
scrollTop.addClass("active");
|
||||
}
|
||||
});
|
||||
$('.agy-scroll-top').click(function() {
|
||||
$("html, body").animate({
|
||||
scrollTop: 0
|
||||
}, 2000);
|
||||
return false;
|
||||
});
|
||||
|
||||
$(function() {
|
||||
$('.go-down-btn').click(function() {
|
||||
$('html, body').animate({ scrollTop: $('#go-down-btn').offset().top }, 'slow');
|
||||
return false;
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
/*-----------------------------------------------------
|
||||
Fix About Page Tabs
|
||||
-----------------------------------------------------*/
|
||||
aboutTabs: function() {
|
||||
$('.agy-tabs-nav li:first-child').addClass('active');
|
||||
$('.agy-single-tab').hide();
|
||||
$('.agy-single-tab:first').show();
|
||||
$('.agy-tabs-nav li').click(function() {
|
||||
$('.agy-tabs-nav li').removeClass('active');
|
||||
$(this).addClass('active');
|
||||
$('.agy-single-tab').hide();
|
||||
var activeTab = $(this).find('a').attr('href');
|
||||
$(activeTab).fadeIn();
|
||||
return false;
|
||||
});
|
||||
},
|
||||
|
||||
/*-----------------------------------------------------
|
||||
Fix Image Animation
|
||||
-----------------------------------------------------*/
|
||||
tiltAnimation: function() {
|
||||
var tiltAnimation = $('.parallax')
|
||||
if (tiltAnimation.length) {
|
||||
tiltAnimation.tilt({
|
||||
max: 12,
|
||||
speed: 1e3,
|
||||
easing: 'cubic-bezier(.03,.98,.52,.99)',
|
||||
transition: !1,
|
||||
perspective: 1e3,
|
||||
scale: 1
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
/*-----------------------------------------------------
|
||||
Fix Gallery Magnific Popup
|
||||
-----------------------------------------------------*/
|
||||
popupGallery: function() {
|
||||
jQuery(document).ready(function() {
|
||||
$('.popup-gallery, .popup-gallery1, .popup-gallery2, .popup-gallery3').magnificPopup({
|
||||
delegate: 'a',
|
||||
type: 'image',
|
||||
tLoading: 'Loading image #%curr%...',
|
||||
mainClass: 'mfp-img-mobile',
|
||||
gallery: {
|
||||
enabled: true,
|
||||
navigateByImgClick: true,
|
||||
preload: [0, 1] // Will preload 0 - before current, and 1 after the current image
|
||||
},
|
||||
image: {
|
||||
tError: '<a href="%url%">The image #%curr%</a> could not be loaded.',
|
||||
titleSrc: function(item) {
|
||||
return item.el.attr('title') + '<small></small>';
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
/*-----------------------------------------------------
|
||||
Fix Cursor
|
||||
-----------------------------------------------------*/
|
||||
cursor: function() {
|
||||
if($('.agy-cursor-inner').length > 0){
|
||||
/*
|
||||
Mouse
|
||||
*/
|
||||
function mousecursor() {
|
||||
if ($("body")) {
|
||||
const e = document.querySelector(".agy-cursor-inner"),
|
||||
t = document.querySelector(".agy-cursor-outer");
|
||||
let n, i = 0,
|
||||
o = !1;
|
||||
window.onmousemove = function(s) {
|
||||
o || (t.style.transform = "translate(" + s.clientX + "px, " + s.clientY + "px)"), e.style.transform = "translate(" + s.clientX + "px, " + s.clientY + "px)", n = s.clientY, i = s.clientX
|
||||
}, $("body").on("mouseenter", "a, .cursor-pointer", function() {
|
||||
e.classList.add("agy-cursor-hover"), t.classList.add("agy-cursor-hover")
|
||||
}), $("body").on("mouseleave", "a, .cursor-pointer", function() {
|
||||
$(this).is("a") && $(this).closest(".cursor-pointer").length || (e.classList.remove("agy-cursor-hover"), t.classList.remove("agy-cursor-hover"))
|
||||
}), e.style.visibility = "visible", t.style.visibility = "visible"
|
||||
}
|
||||
};
|
||||
|
||||
$(function() {
|
||||
mousecursor();
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
};
|
||||
|
||||
Agency.init();
|
||||
|
||||
|
||||
/*-----------------------------------------------------
|
||||
Fix Contact Form Submission
|
||||
-----------------------------------------------------*/
|
||||
// Contact Form Submission
|
||||
function checkRequire(formId, targetResp) {
|
||||
targetResp.html('');
|
||||
var email = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/;
|
||||
var url = /(http|ftp|https):\/\/[\w-]+(\.[\w-]+)+([\w.,@?^=%&:\/~+#-]*[\w@?^=%&\/~+#-])?/;
|
||||
var image = /\.(jpe?g|gif|png|PNG|JPE?G)$/;
|
||||
var mobile = /^[\s()+-]*([0-9][\s()+-]*){6,20}$/;
|
||||
var facebook = /^(https?:\/\/)?(www\.)?facebook.com\/[a-zA-Z0-9(\.\?)?]/;
|
||||
var twitter = /^(https?:\/\/)?(www\.)?twitter.com\/[a-zA-Z0-9(\.\?)?]/;
|
||||
var google_plus = /^(https?:\/\/)?(www\.)?plus.google.com\/[a-zA-Z0-9(\.\?)?]/;
|
||||
var check = 0;
|
||||
$('#er_msg').remove();
|
||||
var target = (typeof formId == 'object') ? $(formId) : $('#' + formId);
|
||||
target.find('input , textarea , select').each(function() {
|
||||
if ($(this).hasClass('require')) {
|
||||
if ($(this).val().trim() == '') {
|
||||
check = 1;
|
||||
$(this).focus();
|
||||
$(this).parent('div').addClass('form_error');
|
||||
targetResp.html('You missed out some fields.');
|
||||
$(this).addClass('error');
|
||||
return false;
|
||||
} else {
|
||||
$(this).removeClass('error');
|
||||
$(this).parent('div').removeClass('form_error');
|
||||
}
|
||||
}
|
||||
if ($(this).val().trim() != '') {
|
||||
var valid = $(this).attr('data-valid');
|
||||
if (typeof valid != 'undefined') {
|
||||
if (!eval(valid).test($(this).val().trim())) {
|
||||
$(this).addClass('error');
|
||||
$(this).focus();
|
||||
check = 1;
|
||||
targetResp.html($(this).attr('data-error'));
|
||||
return false;
|
||||
} else {
|
||||
$(this).removeClass('error');
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
return check;
|
||||
}
|
||||
$(".submitForm").on('click', function() {
|
||||
var _this = $(this);
|
||||
var targetForm = _this.closest('form');
|
||||
var errroTarget = targetForm.find('.response');
|
||||
var check = checkRequire(targetForm, errroTarget);
|
||||
|
||||
if (check == 0) {
|
||||
var formDetail = new FormData(targetForm[0]);
|
||||
formDetail.append('form_type', _this.attr('form-type'));
|
||||
$.ajax({
|
||||
method: 'post',
|
||||
url: 'ajaxmail.php',
|
||||
data: formDetail,
|
||||
cache: false,
|
||||
contentType: false,
|
||||
processData: false
|
||||
}).done(function(resp) {
|
||||
console.log(resp);
|
||||
if (resp == 1) {
|
||||
targetForm.find('input').val('');
|
||||
targetForm.find('textarea').val('');
|
||||
errroTarget.html('<p style="color:green;">Mail has been sent successfully.</p>');
|
||||
} else {
|
||||
errroTarget.html('<p style="color:red;">Something went wrong please try again latter.</p>');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
jQuery(function () {
|
||||
jQuery("input[name=switchPlan]:radio").click(function () {
|
||||
if (jQuery('input[name=switchPlan]:checked').val() == "Light") {
|
||||
jQuery("body").removeClass('dark-mode');
|
||||
jQuery("body").addClass('light-mode');
|
||||
|
||||
} else if (jQuery('input[name=switchPlan]:checked').val() == "Dark") {
|
||||
jQuery("body").removeClass('light-mode');
|
||||
jQuery("body").addClass('dark-mode');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$( document ).ready(function() {
|
||||
var mode = localStorage.getItem('mode');
|
||||
if(mode == 'Dark'){
|
||||
jQuery("body").removeClass('light-mode');
|
||||
jQuery("body").addClass('dark-mode');
|
||||
$('#switchDark ').prop("checked", true);
|
||||
$('#switchLight').removeAttr('checked');
|
||||
} else {
|
||||
jQuery("body").removeClass('dark-mode');
|
||||
jQuery("body").addClass('light-mode');
|
||||
$('#switchLight ').prop("checked", true);
|
||||
$('#switchDark').removeAttr( "checked" );
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on('click', '.mode', function (e) {
|
||||
var mode = $(this).val();
|
||||
localStorage.setItem('mode', mode);
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
|
||||
|
||||
4
wwwroot/js/jquery.magnific-popup.min.js
vendored
Normal file
4
wwwroot/js/jquery.magnific-popup.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
2
wwwroot/js/jquery.min.js
vendored
Normal file
2
wwwroot/js/jquery.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
4
wwwroot/js/jquery.nice-select.min.js
vendored
Normal file
4
wwwroot/js/jquery.nice-select.min.js
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
/* jQuery Nice Select - v1.0
|
||||
https://github.com/hernansartorio/jquery-nice-select
|
||||
Made by Hernán Sartorio */
|
||||
!function(e){e.fn.niceSelect=function(t){function s(t){t.after(e("<div></div>").addClass("nice-select").addClass(t.attr("class")||"").addClass(t.attr("disabled")?"disabled":"").attr("tabindex",t.attr("disabled")?null:"0").html('<span class="current"></span><ul class="list"></ul>'));var s=t.next(),n=t.find("option"),i=t.find("option:selected");s.find(".current").html(i.data("display")||i.text()),n.each(function(t){var n=e(this),i=n.data("display");s.find("ul").append(e("<li></li>").attr("data-value",n.val()).attr("data-display",i||null).addClass("option"+(n.is(":selected")?" selected":"")+(n.is(":disabled")?" disabled":"")).html(n.text()))})}if("string"==typeof t)return"update"==t?this.each(function(){var t=e(this),n=e(this).next(".nice-select"),i=n.hasClass("open");n.length&&(n.remove(),s(t),i&&t.next().trigger("click"))}):"destroy"==t?(this.each(function(){var t=e(this),s=e(this).next(".nice-select");s.length&&(s.remove(),t.css("display",""))}),0==e(".nice-select").length&&e(document).off(".nice_select")):console.log('Method "'+t+'" does not exist.'),this;this.hide(),this.each(function(){var t=e(this);t.next().hasClass("nice-select")||s(t)}),e(document).off(".nice_select"),e(document).on("click.nice_select",".nice-select",function(t){var s=e(this);e(".nice-select").not(s).removeClass("open"),s.toggleClass("open"),s.hasClass("open")?(s.find(".option"),s.find(".focus").removeClass("focus"),s.find(".selected").addClass("focus")):s.focus()}),e(document).on("click.nice_select",function(t){0===e(t.target).closest(".nice-select").length&&e(".nice-select").removeClass("open").find(".option")}),e(document).on("click.nice_select",".nice-select .option:not(.disabled)",function(t){var s=e(this),n=s.closest(".nice-select");n.find(".selected").removeClass("selected"),s.addClass("selected");var i=s.data("display")||s.text();n.find(".current").text(i),n.prev("select").val(s.data("value")).trigger("change")}),e(document).on("keydown.nice_select",".nice-select",function(t){var s=e(this),n=e(s.find(".focus")||s.find(".list .option.selected"));if(32==t.keyCode||13==t.keyCode)return s.hasClass("open")?n.trigger("click"):s.trigger("click"),!1;if(40==t.keyCode){if(s.hasClass("open")){var i=n.nextAll(".option:not(.disabled)").first();i.length>0&&(s.find(".focus").removeClass("focus"),i.addClass("focus"))}else s.trigger("click");return!1}if(38==t.keyCode){if(s.hasClass("open")){var l=n.prevAll(".option:not(.disabled)").first();l.length>0&&(s.find(".focus").removeClass("focus"),l.addClass("focus"))}else s.trigger("click");return!1}if(27==t.keyCode)s.hasClass("open")&&s.trigger("click");else if(9==t.keyCode&&s.hasClass("open"))return!1});var n=document.createElement("a").style;return n.cssText="pointer-events:auto","auto"!==n.pointerEvents&&e("html").addClass("no-csspointerevents"),this}}(jQuery);
|
||||
14
wwwroot/js/swiper-bundle.min.js
vendored
Normal file
14
wwwroot/js/swiper-bundle.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
wwwroot/js/tilt.jquery.min.js
vendored
Normal file
1
wwwroot/js/tilt.jquery.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
2
wwwroot/js/wow.min.js
vendored
Normal file
2
wwwroot/js/wow.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user