diff --git a/core/admin/clients/index.php b/core/admin/clients/index.php
new file mode 100644
index 00000000..22c39758
--- /dev/null
+++ b/core/admin/clients/index.php
@@ -0,0 +1,51 @@
+
+
+
diff --git a/core/admin/clients/meta.json b/core/admin/clients/meta.json
new file mode 100644
index 00000000..dc1ab400
--- /dev/null
+++ b/core/admin/clients/meta.json
@@ -0,0 +1,20 @@
+{
+ "label": "Clients",
+ "menu": "Admin",
+ "order": "52",
+ "icon": "fa-user-circle",
+ "user_levels": [
+ "Admin",
+ "Manager"
+ ],
+ "dashboardPosition": 4,
+ "permissions": {
+ "Manager": {
+ "Add Clients": "Yes",
+ "Edit Clients": "Yes",
+ "Delete Clients": "No"
+ }
+ },
+ "model_namespace": "\\Clients\\Common\\Model",
+ "manager": "\\Clients\\Admin\\Api\\ClientsAdminManager"
+}
diff --git a/core/src/Clients/Admin/Api/ClientsAdminManager.php b/core/src/Clients/Admin/Api/ClientsAdminManager.php
new file mode 100644
index 00000000..a37bea55
--- /dev/null
+++ b/core/src/Clients/Admin/Api/ClientsAdminManager.php
@@ -0,0 +1,26 @@
+addModelClass('Client');
+ }
+}
diff --git a/core/src/Projects/Common/Model/Client.php b/core/src/Clients/Common/Model/Client.php
similarity index 67%
rename from core/src/Projects/Common/Model/Client.php
rename to core/src/Clients/Common/Model/Client.php
index 1dbf8cf0..1af38d6f 100644
--- a/core/src/Projects/Common/Model/Client.php
+++ b/core/src/Clients/Common/Model/Client.php
@@ -6,8 +6,9 @@
* Time: 5:53 PM
*/
-namespace Projects\Common\Model;
+namespace Clients\Common\Model;
+use Classes\ModuleAccess;
use Model\BaseModel;
class Client extends BaseModel
@@ -22,4 +23,11 @@ class Client extends BaseModel
{
return array("get","element","save","delete");
}
+
+ public function getModuleAccess()
+ {
+ return [
+ new ModuleAccess('clients', 'admin'),
+ ];
+ }
}
diff --git a/gulpfile.js b/gulpfile.js
index 1ef8c794..31d45341 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -154,6 +154,7 @@ gulp.task('admin-js', (done) => {
let files = [
'attendance',
'company_structure',
+ 'clients',
'dashboard',
'data',
'documents',
diff --git a/web/admin/dist/clients.js b/web/admin/dist/clients.js
new file mode 100644
index 00000000..f6272c5f
--- /dev/null
+++ b/web/admin/dist/clients.js
@@ -0,0 +1,2 @@
+!function e(t,a,l){function i(o,r){if(!a[o]){if(!t[o]){var s="function"==typeof require&&require;if(!r&&s)return s(o,!0);if(n)return n(o,!0);var c=new Error("Cannot find module '"+o+"'");throw c.code="MODULE_NOT_FOUND",c}var u=a[o]={exports:{}};t[o][0].call(u.exports,(function(e){return i(t[o][1][e]||e)}),u,u.exports,e,t,a,l)}return a[o].exports}for(var n="function"==typeof require&&require,o=0;o0&&localStorage.removeItem(t)}},{key:"getData",value:function(e){var t;if("undefined"==typeof Storage)return null;var a=localStorage.getItem(e);return void 0!==a&&null!=a&&""!==a?void 0===(t=JSON.parse(a))||null==t||void 0!==t.status&&null!=t.status&&"SUCCESS"!==t.status?null:t:null}},{key:"setData",value:function(e,t){if("undefined"==typeof Storage)return null;if(void 0!==t.status&&null!=t.status&&"SUCCESS"!==t.status)return null;var a=JSON.stringify(t);return localStorage.setItem(e,a),a}}])&&l(t.prototype,a),i&&l(t,i),e}();a.default=i},{}],4:[function(e,t,a){"use strict";Object.defineProperty(a,"__esModule",{value:!0}),a.default=void 0;var l=n(e("./ModuleBase")),i=n(e("../api-common/RequestCache"));function n(e){return e&&e.__esModule?e:{default:e}}function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e,t){for(var a=0;a0}},n=function(){function e(t,a,l){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.tempOptions={},this.formId=t,this.formError=!1,this.formObject=null,this.errorMessages="",this.popupDialog=null,this.validateAll=a,this.errorMap=[],this.settings={thirdPartyPopup:null,LabelErrorClass:!1,ShowPopup:!0},this.settings=jQuery.extend(this.settings,l),this.inputTypes=["text","radio","checkbox","file","password","select-one","select-multi","textarea","fileupload","signature"],this.validator=i}var t,a,n;return t=e,a=[{key:"clearError",value:function(e,t){var a=e.attr("id");$("#".concat(this.formId," #field_").concat(a)).removeClass("error"),$("#".concat(this.formId," #help_").concat(a)).html("")}},{key:"addError",value:function(e,t){this.formError=!0,null!=e.attr("message")?(this.errorMessages+="".concat(e.attr("message"),"\n"),this.errorMap[e.attr("name")]=e.attr("message")):this.errorMap[e.attr("name")]="";var a=e.attr("id"),l=e.attr("validation"),i=e.attr("validation");$("#".concat(this.formId," #field_").concat(a)).addClass("error"),void 0===i||null==i||""===i?$("#".concat(this.formId," #help_err_").concat(a)).html(i):void 0===l||null==l||""===l?$("#".concat(this.formId," #help_err_").concat(a)).html("Required"):"float"===l||"number"===l?$("#".concat(this.formId," #help_err_").concat(a)).html("Number required"):"email"===l?$("#".concat(this.formId," #help_err_").concat(a)).html("Email required"):$("#".concat(this.formId," #help_err_").concat(a)).html("Required")}},{key:"showErrors",value:function(){this.formError&&(void 0!==this.settings.thirdPartyPopup&&null!=this.settings.thirdPartyPopup?this.settings.thirdPartyPopup.alert():!0===this.settings.ShowPopup&&(void 0!==this.tempOptions.popupTop&&null!=this.tempOptions.popupTop?this.alert("Errors Found",this.errorMessages,this.tempOptions.popupTop):this.alert("Errors Found",this.errorMessages,-1)))}},{key:"checkValues",value:function(e){this.tempOptions=e;var t=this;this.formError=!1,this.errorMessages="",this.formObject={};var a=function(e){var a=null,l=e.attr("name");!1!==t.settings.LabelErrorClass&&$("label[for='".concat(l,"']")).removeClass(t.settings.LabelErrorClass);var i=e.attr("id"),n=e.attr("type");if(e.hasClass("select2-focusser")||e.hasClass("select2-input"))return!0;if(jQuery.inArray(n,t.inputTypes)>=0){if(e.hasClass("uploadInput"))a=e.attr("val");else if("radio"===n||"checkbox"===n)a=$("input[name='".concat(l,"']:checked")).val();else if(e.hasClass("select2Field"))a=null!=$("#".concat(t.formId," #").concat(i)).select2("data")&&void 0!==$("#".concat(t.formId," #").concat(i)).select2("data")?$("#".concat(t.formId," #").concat(i)).select2("data").id:"";else if(e.hasClass("select2Multi"))if(null!=$("#".concat(t.formId," #").concat(i)).select2("data")&&void 0!==$("#".concat(t.formId," #").concat(i)).select2("data")){var o=$("#".concat(t.formId," #").concat(i)).select2("data");a=[];for(var r=0;r'.concat(this.gt(this.getAddNewLabel()),' ')),null!=this.getFilters()&&(""!==e&&(e+=" "),e+=''),e+=" ",this.filtersAlreadySet?e+='':e+=''),e=e.replace(/__id__/g,this.getTableName()),""!==(e=""!==this.currentFilterString&&null!=this.currentFilterString?e.replace(/__filterString__/g,this.currentFilterString):e.replace(/__filterString__/g,"Reset Filters"))&&(e='")),e}},{key:"getActionButtonHeader",value:function(){return{sTitle:"",sClass:"center"}}},{key:"getTableHTMLTemplate",value:function(){return''}},{key:"isSortable",value:function(){return!0}},{key:"createTable",value:function(e){if(this.getRemoteTable())this.createTableServer(e);else{var t=this.getHeaders();for(var a in t)t[a].sTitle=this.gt(t[a].sTitle);var l,i=this.getTableData();if(this.showActionButtons()&&t.push(this.getActionButtonHeader()),this.showActionButtons())for(var n=0;n")),$("#".concat(e,"ModelLabel")).html(t),$("#".concat(e,"ModelBody")).html(""),$("#".concat(e,"ModelBody")).append(a)}},{key:"deleteRow",value:function(e){this.deleteParams.id=e,this.renderModel("delete","Confirm Deletion","Are you sure you want to delete this item ?"),$("#deleteModel").modal("show")}},{key:"showMessage",value:function(e,t){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]&&arguments[4],n=this,o="";o=i?"#plainMessageModel":"#messageModel",$(o).off(),i?this.renderModel("plainMessage",e,t):this.renderModel("message",e,t),null!=a?($(o).modal({show:!0}),$(o).on("hidden.bs.modal",(function(){a.apply(n,l),$(".modal-backdrop").remove()}))):$(o).modal({backdrop:"static"})}},{key:"showDomElement",value:function(e,t,a,l,i){var n=this,o="";o=i?"#dataMessageModel":"#messageModel",$(o).unbind("hide"),i?this.renderModelFromDom("dataMessage",e,t):this.renderModelFromDom("message",e,t),null!=a?($(o).modal({show:!0}),$(o).on("hidden.bs.modal",(function(){a.apply(n,l),$(".modal-backdrop").remove()}))):$(o).modal({backdrop:"static"})}},{key:"confirmDelete",value:function(){void 0===this.deleteParams.id&&null==this.deleteParams.id||this.deleteObj(this.deleteParams.id,[]),$("#deleteModel").modal("hide")}},{key:"cancelDelete",value:function(){$("#deleteModel").modal("hide"),this.deleteParams.id=null}},{key:"closeMessage",value:function(){$("#messageModel").modal("hide")}},{key:"cancelYesno",value:function(){$("#yesnoModel").modal("hide")}},{key:"closePlainMessage",value:function(){$("#plainMessageModel").modal("hide"),$("#dataMessageModel").modal("hide")}},{key:"closeDataMessage",value:function(){$("#dataMessageModel").modal("hide")}},{key:"save",value:function(e,t){var a=new i.default("".concat(this.getTableName(),"_submit"),!0,{ShowPopup:!1,LabelErrorClass:"error"});if(a.checkValues()){var l=a.getFormParameters();l=this.forceInjectValuesBeforeSave(l);var n=this.doCustomValidation(l);if(null==n){this.csrfRequired&&(l.csrf=$("#".concat(this.getTableName(),"Form")).data("csrf"));var o=$("#".concat(this.getTableName(),"_submit #id")).val();null!=o&&void 0!==o&&""!==o&&(l.id=o),l=this.makeEmptyDateFieldsNull(l),this.add(l,[],e,t)}else $("#".concat(this.getTableName(),"Form .label")).html(n),$("#".concat(this.getTableName(),"Form .label")).show(),this.scrollToTop()}}},{key:"makeEmptyDateFieldsNull",value:function(e){return this.getFormFields().forEach((function(t){"date"!==t[1].type&&"datetime"!==t[1].type||""!==e[t[0]]&&"0000-00-00"!==e[t[0]]&&"0000-00-00 00:00:00"!==e[t[0]]||("none"===t[1].validation?e[t[0]]="NULL":delete e[t[0]])})),e}},{key:"validatePassword",value:function(e){return e.length<8?this.gt("Password too short"):e.length>20?this.gt("Password too long"):e.match(/.*[0-9]+.*$/)?e.match(/.*[a-z]+.*$/)?e.match(/.*[A-Z]+.*$/)?e.match(/.*[\W]+.*$/)?null:this.gt("Password must include at least one symbol"):this.gt("Password must include at least one uppercase letter"):this.gt("Password must include at least one lowercase letter"):this.gt("Password must include at least one number")}},{key:"forceInjectValuesBeforeSave",value:function(e){return e}},{key:"doCustomValidation",value:function(e){return null}},{key:"filterQuery",value:function(){var e=new i.default("".concat(this.getTableName(),"_filter"),!0,{ShowPopup:!1,LabelErrorClass:"error"});if(e.checkValues()){var t=e.getFormParameters();if(this.doCustomFilterValidation(t)){for(var a in t)t.hasOwnProperty(a)&&"NULL"===t[a]&&delete t[a];this.setFilter(t),this.filtersAlreadySet=!0,$("#".concat(this.getTableName(),"_resetFilters")).show(),this.currentFilterString=this.getFilterString(t),this.get([]),this.closePlainMessage()}}}},{key:"getFilterString",value:function(e){var t,a,l,i,n,o,r="",s=this.getFilters();for(var c in null==l&&(l=[]),e)if(e.hasOwnProperty(c)){if(n="",o=null,"select"===(l=this.getMetaFieldValues(c,s)).type||"select2"===l.type){if(void 0!==l["remote-source"]&&null!=l["remote-source"])t=l["remote-source"],"NULL"===e[c]?n=void 0!==l["null-label"]&&null!=l["null-label"]?l["null-label"]:"Not Selected":o=n=this.fieldMasterData["".concat(t[0],"_").concat(t[1],"_").concat(t[2])][e[c]];else if(a=l.source[0],"NULL"===e[c])n=void 0!==l["null-label"]&&null!=l["null-label"]?l["null-label"]:"Not Selected";else for(var u=0;u