Browse Source

forms nearly finished

confirmation-email
Milad Karbasizadeh 11 years ago
parent
commit
1e4d00ab8f
7 changed files with 281 additions and 10 deletions
  1. +1
    -1
      Sevomin.WebFrontend.Controllers/JobController.cs
  2. +258
    -0
      Sevomin.WebFrontend/Scripts/jalaliCalendar.js
  3. +9
    -1
      Sevomin.WebFrontend/Scripts/sevomin-ui.js
  4. +1
    -0
      Sevomin.WebFrontend/Sevomin.WebFrontend.csproj
  5. +8
    -6
      Sevomin.WebFrontend/Views/Job/JobEditor.cshtml
  6. +2
    -1
      Sevomin.WebFrontend/Views/Shared/Intro.cshtml
  7. +2
    -1
      Sevomin.WebFrontend/Views/Shared/_Layout.cshtml

+ 1
- 1
Sevomin.WebFrontend.Controllers/JobController.cs View File

@ -15,7 +15,7 @@ namespace Sevomin.WebFrontend.Controllers
public ActionResult NewJob()
{
Avalin avalin = null;
return View(JobRepository.Current.GetEmptyJobFor(avalin));
return View(/*JobRepository.Current.GetEmptyJobFor(avalin)*/);
}
}


+ 258
- 0
Sevomin.WebFrontend/Scripts/jalaliCalendar.js View File

@ -0,0 +1,258 @@
/**
* @author Javad Mowlanezhad jmowla@gmail.com
* @version 1.0.0
*/
(function($) {
function JalaliCalendar() {
var _jDIM = [31, 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 29];
var _gDIM = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
/**
* Checks input parameter for Array object, if the object is Array returns true otherwise false
* @param a
*/
function _isArray(a) {
return (a && a.constructor && a.constructor.toString().match(/\Array\(\)/));
}
function _div(a, b) {
return Math.floor(a / b);
}
function _ds2da(ds) {
if (_isArray(ds))
return ds;
if (ds == "")
return [];
var da = ds.split(" ")[0].split("-");
if (da[1] == undefined)
da = ds.split(" ")[0].split("/");
return da;
}
function _ivda(da) {
return !(da[0] === "" || da[1] === "" || da[2] === "");
}
function _isjvd(d) {
d = _ds2da(d);
var j = _g2j(_j2g(d));
return d[0] === j[0] && d[1] === j[1] && d[2] === j[2];
}
function _isgvd(d) {
d = _ds2da(d);
var g = _j2g(_g2j(d));
return d[0] === g[0] && d[1] === g[1] && d[2] === g[2];
}
function _j2JUL(j) {
var jy, jm, jd, jdn,i;
jy = j[0] - 979;
jm = j[1] - 1;
jd = j[2] - 1;
jdn = 365 * jy + _div(jy, 33) * 8 + _div((jy % 33 + 3), 4);
for (i = 0; i < jm; ++i)
jdn += _jDIM[i];
return jdn + jd;
}
function _JUL2j(gdn) {
var gy, gm, gd, leap, i;
gy = 1600 + 400 * _div(gdn, 146097);
gdn = gdn % 146097;
leap = 1;
if (gdn >= 36525) {
gdn--;
gy += 100 * _div(gdn, 36524);
gdn = gdn % 36524;
if (gdn >= 365)
gdn++;
else
leap = 0;
}
gy += 4 * _div(gdn, 1461);
gdn %= 1461;
if (gdn >= 366) {
leap = 0;
gdn--;
gy += _div(gdn, 365);
gdn = gdn % 365;
}
for (i = 0; gdn >= _gDIM[i] + (i == 1 && leap); i++)
gdn -= _gDIM[i] + (i == 1 && leap);
gm = i + 1;
gd = gdn + 1;
return [gy, gm, gd];
}
function _g2JUL(g) {
var gy, gm, gd, gdn, i;
gy = g[0] - 1600;
gm = g[1] - 1;
gd = g[2] - 1;
gdn = 365 * gy + _div((gy + 3), 4) - _div((gy + 99), 100) + _div((gy + 399), 400);
for (i = 0; i < gm; ++i)
gdn += _gDIM[i];
if (gm > 1 && ((gy % 4 == 0 && gy % 100 != 0) || (gy % 400 == 0)))
++gdn;
return gdn + gd;
}
function _JUL2g(jdn) {
var j_np, jy, jm, jd, i;
j_np = _div(jdn, 12053);
jdn %= 12053;
jy = 979 + 33 * j_np + 4 * _div(jdn, 1461);
jdn %= 1461;
if (jdn >= 366) {
jy += _div((jdn - 1), 365);
jdn = (jdn - 1) % 365;
}
for (i = 0; i < 11 && jdn >= _jDIM[i]; ++i)
jdn -= _jDIM[i];
jm = i + 1;
jd = jdn + 1;
return [jy, jm, jd];
}
function _j2g(j) {
j = _ds2da(j);
if (!_ivda(j))
return [];
return _JUL2j(_j2JUL(j) + 79);
}
function _g2j(g) {
g = _ds2da(g);
if (!_ivda(g))
return [];
return _JUL2g(_g2JUL(g) - 79);
}
return {
gregorianToJalali: function(g) {
return _g2j(g);
},
gregorianToJalaliStr: function(_g) {
var g = _ds2da(_g);
if (!_ivda(g))
return "";
var j = _g2j(g);
return j[0] + "/" + (j[1] > 9 ? j[1] : "0" + j[1]) + "/" + (j[2] > 9 ? j[2] : "0" + j[2]);
},
jalaliToGregorianStr: function (_j, _st) {
var j = _ds2da(_j);
if (!_ivda(j))
return "";
var g = _j2g(j);
return g[0] + "/" + g[1] + "/" + g[2] + (!_st ? "" : " " + _j.split(" ")[1].split(".")[0]);
},
jalaliToGregorian: function(j) {
return _j2g(j);
},
today: function() {
var _today = new Date();
return this.gregorianToJalaliStr([_today.getFullYear(),(_today.getMonth() + 1),_today.getDate()]);
},
isValidJ: function(d) {
return _isjvd(d);
},
isValidG: function(d) {
return _isgvd(d);
},
getDaysInMonth: function(y, m) {
return 32 - new Date(y, m, 32).getDate();
},
version: "1.0.0"
};
};
if ($._gDate == undefined) {
Date.prototype._getFullYear = Date.prototype.getFullYear;
Date.prototype._setFullYear = Date.prototype.setFullYear;
Date.prototype._getMonth = Date.prototype.getMonth;
Date.prototype._setMonth = Date.prototype.setMonth;
Date.prototype._getDate = Date.prototype.getDate;
Date.prototype._setDate = Date.prototype.setDate;
Date.prototype._getCJD = function() {
return $.jalaliCalendar.gregorianToJalali([this._getFullYear(), this._getMonth() + 1, this._getDate()]);
};
Date.prototype.getFullYear = function() {
return this._getCJD()[0];
};
Date.prototype.setFullYear = function(y) {
var j = this._getCJD();
var g = $.jalaliCalendar.jalaliToGregorian([y, j[1], j[2]]);
this._setDate(1);
this._setFullYear(g[0]);
this._setMonth(g[1] - 1);
this._setDate(g[2]);
};
Date.prototype.getMonth = function() {
return this._getCJD()[1] - 1;
};
Date.prototype.setMonth = function(m) {
var j = this._getCJD();
var g = $.jalaliCalendar.jalaliToGregorian([j[0], m + 1, j[2]]);
this._setDate(1);
this._setFullYear(g[0]);
this._setMonth(g[1] - 1);
this._setDate(g[2]);
};
Date.prototype.getDate = function() {
return this._getCJD()[2];
};
Date.prototype.setDate = function(d) {
var j = this._getCJD();
var g = $.jalaliCalendar.jalaliToGregorian([j[0], j[1], d]);
this._setDate(1);
this._setFullYear(g[0]);
this._setMonth(g[1] - 1);
this._setDate(g[2]);
};
$._gDate = Date; // save original Date object for further reference and use
window.Date = function() {
this.prototype = $._gDate.prototype;
var _p = [], _al = arguments.length;
for (var i = 0; i < _al; i++)
_p.push(arguments[i]);
var _d = null;
if (_al == 0)
_d = new $._gDate();
else if (_al == 1) {
_d = new $._gDate(_p[0]);
} else if (_al >= 3) {
_p[1]++;
var _g = $.jalaliCalendar.jalaliToGregorian(_p);
for (i = 3; i < _al; i++)
_g.push(_p[i]);
for (i = _al; i < 7; i++)
_g.push(0);
_d = new $._gDate(_g[0], _g[1] - 1, _g[2], _g[3], _g[4], _g[5], _g[6]);
}
return _d;
};
}
if ($.jalaliCalendar == undefined) {
$.jalaliCalendar = new JalaliCalendar();
window.jalaliCalendar= $.jalaliCalendar;
}
})(jQuery);

+ 9
- 1
Sevomin.WebFrontend/Scripts/sevomin-ui.js View File

@ -1,5 +1,13 @@
// This file depends heavily on jquery, jquery validation and jquery ui. So be nice and include them on the page.
// This file depends heavily on jquery, jquery validation, jquery ui and bootstrap.js. So be nice and include them on the page.
$(function () {
$('form').validate();
$('input.datepickerify').datepicker($.datepicker.regional["fa"]);
/* Setup tooltip */
$('.form-help').each(function () {
if ($(this).data('for') != undefined) {
$('#' + $(this).data('for')).tooltip({ trigger: 'focus', title: $(this).attr('title'), placement: 'left' });
}
$(this).tooltip();
});
});

+ 1
- 0
Sevomin.WebFrontend/Sevomin.WebFrontend.csproj View File

@ -203,6 +203,7 @@
<None Include="Scripts\jquery-1.10.2.intellisense.js" />
<Content Include="Scripts\bootstrap.js" />
<Content Include="Scripts\bootstrap.min.js" />
<Content Include="Scripts\jalaliCalendar.js" />
<Content Include="Scripts\jquery-2.1.0.js" />
<Content Include="Scripts\jquery-2.1.0.min.js" />
<Content Include="Scripts\jquery-2.1.0.min.map" />


+ 8
- 6
Sevomin.WebFrontend/Views/Job/JobEditor.cshtml View File

@ -1,4 +1,6 @@
@using (Html.BeginForm("", "", FormMethod.Post, new { role = "form" }))
@model Sevomin.Models.JobParameterViewModel
@using (Html.BeginForm("", "", FormMethod.Post, new { role = "form" }))
{
<div class="row rtl">
<div class="panel panel-default">
@ -11,21 +13,21 @@
</div>
<div class="form-group">
<label for="exampleInputEmail1">نماینده</label>
<input type="email" class="form-control" id="exampleInputEmail1" placeholder="Enter email">
<input type="email" class="form-control" placeholder="Enter email">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label for="exampleInputEmail1">تاریخ انقضا</label> <span class="glyphicon glyphicon-exclamation-sign form-help" data-toggle="tooltip" data-placement="bottom" title="Tooltip on bottom"></span>
<input type="text" class="form-control datepickerify" id="exampleInputEmail1" placeholder="Enter email" data-hint="سلام چطوری؟">
<label for="exampleInputEmail1">تاریخ انقضا</label> <span class="glyphicon glyphicon-exclamation-sign form-help" data-toggle="tooltip" data-for="boogh" data-placement="top" title="این یک راهنما برای این فیلد است"></span>
<input type="text" class="form-control datepickerify" id="boogh" placeholder="Enter email">
</div>
<div class="form-group">
<label for="exampleInputEmail1">محیط کاری</label>
<input type="email" class="form-control" id="exampleInputEmail1" placeholder="Enter email">
<input type="email" class="form-control" placeholder="Enter email">
</div>
<div class="form-group">
<label for="exampleInputEmail1">محل کار</label>
<input type="email" class="form-control" id="exampleInputEmail1" placeholder="Enter email">
<input type="email" class="form-control" placeholder="Enter email">
</div>
</div>
</div>


+ 2
- 1
Sevomin.WebFrontend/Views/Shared/Intro.cshtml View File

@ -18,10 +18,11 @@
</div>
<script src="@Url.Content("~/scripts/jquery-2.1.0.min.js")"></script>
<script src="@Url.Content("~/scripts/jquery-ui-1.10.4.js")"></script>
<script src="@Url.Content("~/scripts/jalaliCalendar.js")"></script>
<script src="@Url.Content("~/scripts/jquery-ui-i18n.min.js")"></script>
<script src="@Url.Content("~/scripts/jquery.validate.min.js")"></script>
<script src="@Url.Content("~/scripts/jquery.validate.unobtrusive.min.js")"></script>
<script src="@Url.Content("~/scripts/bootstrap.min.js")"></script>
<script src="@Url.Content("~/scripts/bootstrap.min.js")"></script>
<script src="@Url.Content("~/scripts/sevomin-ui.js")"></script>
</body>
</html>

+ 2
- 1
Sevomin.WebFrontend/Views/Shared/_Layout.cshtml View File

@ -15,7 +15,8 @@
@RenderBody()
</div>
<script src="@Url.Content("~/scripts/jquery-2.1.0.min.js")"></script>
<script src="@Url.Content("~/scripts/jquery-ui-1.10.4.js")"></script>
<script src="@Url.Content("~/scripts/jquery-ui-1.10.4.min.js")"></script>
<script src="@Url.Content("~/scripts/jalaliCalendar.js")"></script>
<script src="@Url.Content("~/scripts/jquery-ui-i18n.min.js")"></script>
<script src="@Url.Content("~/scripts/jquery.validate.min.js")"></script>
<script src="@Url.Content("~/scripts/jquery.validate.unobtrusive.min.js")"></script>


Loading…
Cancel
Save